#pragma once

#include "Unmanaged\Section.h"
#include "vcclr.h"

using namespace System;

namespace USI
{
public ref class Converter
{
public:
	static _tstring ToTString(String ^str)
	{
		pin_ptr<const wchar_t> wch = PtrToStringChars(str);
		const size_t newsize = 100;

	#ifdef _UNICODE
		return wch;
	#else
		size_t origsize = wcslen(wch) + 1;
		size_t convertedChars = 0;
		char nstring[newsize];
		wcstombs_s(&convertedChars, nstring, origsize, wch, _TRUNCATE);
		return nstring;
	#endif
	}

	static String ^ToNetString(const TCHAR *str)
	{
		return gcnew String(str);
	}
};

}